home *** CD-ROM | disk | FTP | other *** search
/ Logiciels PC 7 / logiciel pc 7.iso / Linux / KDE_1.1pr2_Rpm / kdesupport-1.1pre2-1rh5x.i386.rpm / kdesupport-1.1pre2.1rh5x.cpio.gz / kdesupport-1.1pre2.1rh5x.cpio / opt / kde / bin / kdm_off < prev    next >
Text File  |  1999-01-27  |  2KB  |  72 lines

  1. #!/bin/bash
  2. # script for removing kdm and restoring xdm as the runlevel 5 Display Manager
  3. # (for RedHat 5.x Linux)
  4. INITTAB="/etc/inittab"
  5. XSETUP="/etc/X11/xdm/Xsetup_0"
  6.  
  7.  
  8. echo 'Restoring xdm as the default X Display Manager'
  9. echo '(reverses changes made to /etc/inittab, /etc/X11/xdm/Xsetup_0 by "kdm_on")'
  10.  
  11. if ! [ -f $INITTAB ] ; then
  12.     echo "error: $INITTAB does not exist: exiting"
  13.     exit
  14. fi 
  15.  
  16. if ! [ -f $XSETUP ] ; then
  17.     echo "error: $XSETUP does not exist: exiting"
  18.     exit
  19. fi
  20.  
  21. if ! cp -pf $INITTAB $INITTAB.tmp ; then 
  22.      echo 'error: "kdm_off" must be run as root: exiting' 
  23.      exit
  24. fi
  25. cp -pf $XSETUP $XSETUP.tmp
  26.  
  27. grep kdm $INITTAB  > $INITTAB.tmp
  28. if ! [ -s $INITTAB.tmp ] ; then
  29.      echo "kdm_off: no reference to kdm found in $INITTAB: exiting"
  30.      exit
  31. fi
  32.  
  33. # using $XSETUP.tmp as a temporary file while processing $XINITTAB
  34. sed  -e "/kdm/d" $INITTAB > $XSETUP.tmp
  35. sed -e "s/^\#x:5:respawn:/x:5:respawn:/g" $XSETUP.tmp > $INITTAB.tmp
  36.  
  37. grep xdm $INITTAB.tmp  | grep x:5:respawn: > $XSETUP.tmp
  38. if ! [ -s $XSETUP.tmp ] ; then
  39.     echo "error: original call to xdm in $INITTAB was not commented out"
  40.     echo "you will have to edit $INITTAB manually; exiting"
  41.     exit
  42. fi
  43.  
  44. # modify Xsetup_0
  45. sed  -e "/kdmdesktop/d" $XSETUP > $XSETUP.tmp
  46.  
  47. echo "saving old  $XSETUP as $XSETUP.kdesave"
  48. mv -f $XSETUP  $XSETUP.kdesave
  49. mv -f $XSETUP.tmp  $XSETUP
  50.  
  51. echo "saving old  $INITTAB as $INITTAB.kdesave"
  52. mv -f $INITTAB $INITTAB.kdesave
  53. mv -f $INITTAB.tmp $INITTAB
  54.  
  55. echo "xdm is now restored as the runlevel-5 X Display Manager"
  56. echo 'To restart runlevel 5 using xdm, type "telinit 3 ; telinit 5" '
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.